﻿@using Models;
@model player
@{
    ViewBag.Title = "评分墙";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<link href="~/Areas/Admin/HTML/css/screen.css?v=(@DateTime.Now.ToString("yyyyMMddHHmmssffff"))" rel="stylesheet" />
<div class="screen-content">
    <div class="screen-header">
        <h1 style="line-height:100px;letter-spacing:5px;"><img style="margin-right: 10px;" src="~/Areas/Admin/HTML/screenimgs/icon-player.png" />选手得分</h1>
        <img class="qr-code" src="/Areas/Admin/HTML/screenimgs/QRcode.jpg?v=1" onclick="showImg(this)" />
    </div>
    <div class="expert-out-content">
        <div class="expert-content-bar"></div>
        <div class="expert-content@(Model.id>0?"":" display-none")" id="score-opened">
            <div class="player-name">
                <p><span id="sort">@(Model.sort)</span> 号选手 <span id="name">@(Model.name)</span></p>
            </div>
            <div class="player-info">
                <div class="player-avatar">
                    <img id="headimg" src="@Model.headimg" />
                </div>
                <ul class="player-score-list">
                    @*<li>
                        专家评委平均分
                        <span id="expert-score" class="purple">@Model.ExpertScoreStr</span>
                        <span class="purple">分</span>
                    </li>*@
                    @*<li>
                        大众评委平均分
                        <span id="public-score" class="purple">@Model.PublicScoreStr</span>
                        <span class="purple">分</span>
                    </li>*@
                    <li>
                        选手得分
                        <span id="total-score" class="gold">@Model.TotalScoreStr</span>
                        <span class="gold">分</span>
                    </li>
                </ul>
            </div>
        </div>
        <div class="expert-content@(Model.id>0?" display-none":"")" id="score-no-open">
            <div class="not-open">
                <p>打分暂未开始，请在【选手管理】中开启选手打分</p>
                <a class="lottery-btn" href="/admin/player/index" target="_blank">开启选手打分</a>
            </div>
        </div>
    </div>
</div>
<script>
    setInterval(function () {
        $.get('/admin/screen/scorewall', null, function (res) {
            if (res.status) {
                if (res.data.id > 0) {
                    $("#score-no-open").addClass("display-none");
                    $("#score-opened").removeClass("display-none");

                    $("#sort").text(res.data.sort);
                    $("#name").text(res.data.name);
                    $("#headimg").attr("src", res.data.headimg);
                    $("#expert-score").text(res.data.ExpertScoreStr);
                    $("#public-score").text(res.data.PublicScoreStr);
                    $("#total-score").text(res.data.TotalScoreStr);
                } else {
                    $("#score-opened").addClass("display-none");
                    $("#score-no-open").removeClass("display-none");
                }
            } else {
                alert(res.errmsg);
            }
        })
    }, 3000);
    function showImg(target) {
        var img = $(target).attr("src");
        layer.open({
            type: 1,
            offset: '20px',
            title: false,
            skin: 'layui-layer-demo', //样式类名
            closeBtn: 1, //不显示关闭按钮
            shadeClose: true, //开启遮罩关闭
            area: ['700px', '700px'],
            content: '<img src="' + img + '" width="100%"/>'
        });
    }
</script>